﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;

namespace Enterprise.Admin.Handle.Term
{
    public partial class Add : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var name = Fq("CoName").SafeToString();
                var nameEn = Fq("CoNameEn").SafeToString();
                var content = Fq("CoContent").SafeToString();
                var contentEn = Fq("CoContentEn").SafeToString();
                var sorts = Fq("CoSort").SafeToInt();
                var termService = new TermService();
                termService.Add(name, nameEn, content, contentEn, DateTime.Now, sorts);
                result = (new { state = true, message = "添加成功！" });
            }
            catch (Exception ex)
            {
                result = (new { state = false, message = ex.Message });
            }
            Json(result);
        }
    }
}